package com.dy.controller;

import com.dy.service.SugarService;
import com.sugar.SugarUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @projectName: day0610
 * @package: com.dy.controller
 * @className: SugarController
 * @author: DuanYu
 * @description: TODO
 * @date: 2024/6/10 16:07
 * @version: 1.0
 */
@RestController
public class SugarController {
    @Autowired
    SugarService service;
    @RequestMapping("/listTwo")
    public Map showTwo(){
        return SugarUtil.getBarData(service.showTwo());
    }
    @RequestMapping("/listAge")
    public Map showAge(){
        return SugarUtil.getPieData(service.showTwo());
    }
    @RequestMapping("/listYys")
    public Map showYys(){
        return SugarUtil.getPieData(service.showYys());
    }
    @RequestMapping("/listPp")
    public String showPp(){
       List list =  new ArrayList<>();
       list.add("品牌");
       list.add("性别");
       list.add("总金额");
        return SugarUtil.getTablePlayData(list,service.showPp());
    }
}
